const { createProxyMiddleware } = require('http-proxy-middleware');

/**
 * 跨域代理配置
 * 必须在请求http://localhost:5000后面加一层 /api
 */
module.exports = function(app){
  app.use(createProxyMiddleware('/api',
    {
      'target': 'http://localhost:5000',
      'changeOrigin': true,
      'pathRewrite': {
        '^/api': '/'
      }
    }));
};